package com.wxy.demo.core;

import lombok.Data;
import org.springframework.data.domain.Page;

import java.util.List;

@Data
public class PageResult<T> {

    private List<T> list;

    private long pages;

    private long total;

    public PageResult(List<T> list, long pages, long total) {
        this.list = list;
        this.pages = pages;
        this.total = total;
    }

    public PageResult(Page<T> page) {
        this.list = page.getContent();
        this.pages = page.getTotalPages();
        this.total = page.getTotalElements();
    }
}
